#!/usr/bin/env python
# -*- coding:utf-8 -*-

# https://blog.csdn.net/seeker3/article/details/103830681
# 没有指定参数时，用 xxx['value']=Int 的形式来更新进度条数值(状态）；
# 指定参数时，用 参数.set(Int) 的形式。
# progress_bar.update() 是能看到进度条动态显示的关键。

import tkinter as tk
from tkinter import ttk
import time


def main():
    win = tk.Tk()

    # progressbarVar=tk.IntVar()

    progress_bar = ttk.Progressbar(win, orient='horizontal', length=286, mode='determinate')  ##

    # progress_bar=ttk.Progressbar(win, orient='horizontal', length=286, mode='determinate', variable=progressbarVar)

    progress_bar.grid(column=0, row=0, padx=5, pady=5)

    progress_bar['maximum'] = 100
    for i in range(101):
        progress_bar['value'] = i  ##
        # progressbarVar.set(i)
        progress_bar.update()
        time.sleep(0.05)

    win.mainloop()


if __name__ == "__main__":
    main()
